<?php
/**
* The environment in which the current request is executing.
*
* To determine which environment you're currently operating in, use something
* like the following:
* $isAdmin = Config::get('ext.Scribble.environment') & ScribbleEnvironment::ADMIN
*
* Copyright (c) 2009 James Gauld <james@jamesgauld.net>
* This file is part of Scribble.
* @license http://www.scribblecms.co.uk/license.txt
*
* @package Scribble
*/
use Buan\Config;
class ScribbleEnvironment {

	/**
	* The ADMIN environment is used when operating in the Scribble admin UIs.
	*
	* @constant int
	*/
	const ADMIN = 1;

	/**
	* The FRONTEND environment is used for the public facing site.
	*
	* @constant int
	*/
	const FRONTEND = 2;

	/**
	* Return the current environment.
	*
	* @return int
	*/
	static public function get() {
		return Config::get('ext.Scribble.environment');
	}

	/**
	* Determine if the current environment is ADMIN.
	*
	* @return bool
	*/
	static public function isAdmin() {
		return Config::get('ext.Scribble.environment')===self::ADMIN;
	}

	/**
	* Determine if the current environment is FRONTEND
	*
	* @return bool
	*/
	static public function isFrontend() {
		return Config::get('ext.Scribble.environment')===self::FRONTEND;
	}

	/**
	* Set the current environment.
	*
	* @return void
	*/
	static public function set($env) {
		Config::set('ext.Scribble.environment', $env);
	}
}
?>